package com.medical.project.system.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.medical.project.system.mapper.FamilyMemberMapper;
import com.medical.project.system.domain.FamilyMember;
import com.medical.project.system.service.IFamilyMemberService;

/**
 * 家庭成员Service业务层处理
 *
 * @author tale
 * @date 2020-06-20
 */
@Service
public class FamilyMemberServiceImpl implements IFamilyMemberService {
    @Autowired
    private FamilyMemberMapper familyMemberMapper;

    /**
     * 查询家庭成员
     *
     * @param id 家庭成员ID
     * @return 家庭成员
     */
    @Override
    public FamilyMember selectFamilyMemberById(Long id) {
        return familyMemberMapper.selectFamilyMemberById(id);
    }

    /**
     * 查询家庭成员列表
     *
     * @param familyMember 家庭成员
     * @return 家庭成员
     */
    @Override
    public List<FamilyMember> selectFamilyMemberList(FamilyMember familyMember) {
        return familyMemberMapper.selectFamilyMemberList(familyMember);
    }


    /**
     * 查询某家庭没参合成员
     *
     * @param familyCode
     * @return
     */
    @Override
    public FamilyMember selectNoJoin(String familyCode) {

        return familyMemberMapper.selectNoJoin(familyCode);
    }

    /**
     * 新增家庭成员
     *
     * @param familyMember 家庭成员
     * @return 结果
     */
    @Override
    public int insertFamilyMember(FamilyMember familyMember) {
        return familyMemberMapper.insertFamilyMember(familyMember);
    }

    /**
     * 更新参合状态
     *
     * @param idCard
     * @return
     */
    @Override
    public int updateState(String idCard){

        return familyMemberMapper.updateState(idCard);
    }

    /**
     * 修改家庭成员
     *
     * @param familyMember 家庭成员
     * @return 结果
     */
    @Override
    public int updateFamilyMember(FamilyMember familyMember) {
        return familyMemberMapper.updateFamilyMember(familyMember);
    }

    /**
     * 批量删除家庭成员
     *
     * @param ids 需要删除的家庭成员ID
     * @return 结果
     */
    @Override
    public int deleteFamilyMemberByIds(Long[] ids) {
        return familyMemberMapper.deleteFamilyMemberByIds(ids);
    }

    /**
     * 删除家庭成员信息
     *
     * @param id 家庭成员ID
     * @return 结果
     */
    @Override
    public int deleteFamilyMemberById(Long id) {
        return familyMemberMapper.deleteFamilyMemberById(id);
    }
}
